package com.itheima.TCP;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo01 {
    public static void main(String[] args) throws IOException {
        //创建服务器端对象
        ServerSocket serverSocket = new ServerSocket(10086);
        //监听要连接到此的套接字并接受它
        Socket socket = serverSocket.accept();
        //输入流
        InputStream is = socket.getInputStream();
        byte[] bytes = new byte[1024];
        //读数据
        int len = is.read(bytes);
        System.out.println(new String(bytes,0,len));
    }
}
